package apache;

import java.net.ServerSocket;
import java.net.Socket;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import mvc.bean.MvcBean;
import mvc.utils.MvcUtils;

public class MyApacheTomcat {

	public static void main(String[] args) {
		ExecutorService pool = Executors.newFixedThreadPool(3);
		try {
			Map<String, MvcBean> map=MvcUtils.mvcUtils("mvc.xml");//加载xml文件
			//把数据放入缓存中去
			ApplicationCache.getInstance().put("mvc", map);
			System.out.println(ApplicationCache.getInstance().get("mvc"));
			ServerSocket socket = new ServerSocket(8080);
			System.out.println("web服务器已经成功启动...");
			while(true){
				Socket client=socket.accept();	
				pool.execute(new ClientService(client));
			}
		} catch (Exception e) {
			e.printStackTrace();
		}

	}

}
